Modbus RTU Protocol

ModbusRemote Terminal Unit (RTU) Protocol is a messaging structure used to establish master–slave communications between intelligent devices. When a Modbusmaster sends a message to a Modbus slave, the message contains the address of the slave, the function, the data and a checksum. The slave’s response message contains fields confirming the master’s request, any data requested and an error–checking field.

  • Even though the Modbus protocol allow frames up to 255 bytes long, the drives cannot receive Modbus frames longer than 128 bytes.

A typical Modbus RTU frame consists of the following fields:

ADDRESS FUNCTION DATA CHECKSUM
Address field
  • The address field of a message contains 8 bits.

  • Valid slave addresses are in the range of 0 – 247 decimal.

  • The individual slave devices are set in the range of 1 – 247 decimal (address 0 is the broadcast to all slaves address).

  • The master specifies a slave by placing the slave address in the address field of the message. When the slave responds, it places its own address in the address field to identify to the master which slave is responding.

Function code field
  • The function code field of a message contains 8 bits.

  • Valid function codes are in the range of 1 – 255 decimal.

  • The function code instructs the slave which action to take.

Data field
  • The data field contains additional information the slave uses to execute the action defined by the function code.

  • This can include information such as internal addresses or quantity of items to be handled.

  • The data field of a response from a slave to a master contains the data requested if no error occurs.

Checksum field
  • The checksum field is used for error checking. The checksum field consists of two bytes, creating a 16 bit binary value.

  • The cyclic redundancy check (CRC) is calculated in the transmitting device, then recalculated and compared by the receiving device.

  • The slave device checks the entire message frame during receipt.

For details on how the checksum is computed refers to chapter ‘CRC Generation’ in the PI-MBUS-300 Modbus Reference Guide.